import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/closure/gate_region_entity.dart';

GateRegionEntity $GateRegionEntityFromJson(Map<String, dynamic> json) {
  final GateRegionEntity gateRegionEntity = GateRegionEntity();
  final String? allRegionIds = jsonConvert.convert<String>(json['allRegionIds']);
  if (allRegionIds != null) {
    gateRegionEntity.allRegionIds = allRegionIds;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    gateRegionEntity.companyCode = companyCode;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    gateRegionEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    gateRegionEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    gateRegionEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    gateRegionEntity.deleted = deleted;
  }
  final List<dynamic>? hazardFacilities = (json['hazardFacilities'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (hazardFacilities != null) {
    gateRegionEntity.hazardFacilities = hazardFacilities;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    gateRegionEntity.id = id;
  }
  final List<dynamic>? majorHazardInformations = (json['majorHazardInformations'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (majorHazardInformations != null) {
    gateRegionEntity.majorHazardInformations = majorHazardInformations;
  }
  final int? maximumCapacity = jsonConvert.convert<int>(json['maximumCapacity']);
  if (maximumCapacity != null) {
    gateRegionEntity.maximumCapacity = maximumCapacity;
  }
  final String? regionName = jsonConvert.convert<String>(json['regionName']);
  if (regionName != null) {
    gateRegionEntity.regionName = regionName;
  }
  final int? regionalLevel = jsonConvert.convert<int>(json['regionalLevel']);
  if (regionalLevel != null) {
    gateRegionEntity.regionalLevel = regionalLevel;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    gateRegionEntity.remark = remark;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    gateRegionEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    gateRegionEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    gateRegionEntity.updateDate = updateDate;
  }
  final int? numberOfAppointments = jsonConvert.convert<int>(json['numberOfAppointments']);
  if (numberOfAppointments != null) {
    gateRegionEntity.numberOfAppointments = numberOfAppointments;
  }
  return gateRegionEntity;
}

Map<String, dynamic> $GateRegionEntityToJson(GateRegionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['allRegionIds'] = entity.allRegionIds;
  data['companyCode'] = entity.companyCode;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['hazardFacilities'] = entity.hazardFacilities;
  data['id'] = entity.id;
  data['majorHazardInformations'] = entity.majorHazardInformations;
  data['maximumCapacity'] = entity.maximumCapacity;
  data['regionName'] = entity.regionName;
  data['regionalLevel'] = entity.regionalLevel;
  data['remark'] = entity.remark;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  data['numberOfAppointments'] = entity.numberOfAppointments;
  return data;
}

extension GateRegionEntityExtension on GateRegionEntity {
  GateRegionEntity copyWith({
    String? allRegionIds,
    String? companyCode,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    List<dynamic>? hazardFacilities,
    String? id,
    List<dynamic>? majorHazardInformations,
    int? maximumCapacity,
    String? regionName,
    int? regionalLevel,
    String? remark,
    String? updateBy,
    String? updateById,
    String? updateDate,
    int? numberOfAppointments,
  }) {
    return GateRegionEntity()
      ..allRegionIds = allRegionIds ?? this.allRegionIds
      ..companyCode = companyCode ?? this.companyCode
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..hazardFacilities = hazardFacilities ?? this.hazardFacilities
      ..id = id ?? this.id
      ..majorHazardInformations = majorHazardInformations ?? this.majorHazardInformations
      ..maximumCapacity = maximumCapacity ?? this.maximumCapacity
      ..regionName = regionName ?? this.regionName
      ..regionalLevel = regionalLevel ?? this.regionalLevel
      ..remark = remark ?? this.remark
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate
      ..numberOfAppointments = numberOfAppointments ?? this.numberOfAppointments;
  }
}
